Midterm ADB - Juan Manuel Rodríguez Barragán - 201317864

The main objective for this section of the midterm is to deliver a tool that can both test an Android app through ADB and also generate a report with detailed explanations of the test results. We expect your test suite to do the following:
  1. Install an android apk through ADB on either an emulator or an actual device.
  2. Launch the installed app.
  3. You are required to perform the events described below sequentially, until you have performed a total of N actions (have N be a parameter on your script)
  4. You are required to press the back button (through ADB) every X number of events, whilst maintaining the same order of events (insert, not replace), where X is your student code module 4 plus the last digit of your student code (std%4 + last digit). e.g. for student code 201618493, you would have to press back after every 4th event.
  5. Uninstall the app.
Your tool is also required to generate a report with the following properties:
  • All events performed are listed in sequence on a document (PDF or HTML), each one with a header or description to identify which action was performed.
  • A screenshot of each listed event is shown under it in the document. The screenshot must have been taken during run time at the exact moment of the execution of said event.
The sequence of events that we expect you to use is described in section 1 and 2 of this assignment.
For this section we expect you to deliver the source code (on the programming language of your choice) that performs the tests and generates the report as well as the APK that you are working with.

Solution:
  • For this midterm I will use an Emulator called Nox, that's because I do not have any android device at home.

Calculate the number of events until next "back" command:

In [1]:
#Define the student id and also N (number of actions the script should perform)

student_code = 201317864

N = 8

steps = student_code % 4 + 4


print("The number of events until next back command for this student is: " + str(steps) )

print("The number of times the cicle will repeat is: " + str(N))
The number of events until next back command for this student is: 4
The number of times the cicle will repeat is: 8

PREPARATION METHODS:

In [2]:
##connection to the device via ADB

import os
import time
from IPython.display import Image
from IPython.display import display
import PIL.Image
import subprocess



#Path for the APK
apk_path = "C:/Users/User/Documents/ADB/com.twitter.android.apk"

#Project path 
project_path = "C:/Users/User/Documents/ADB"

#APK name
apk_name = "com.twitter.android"

# path for the adb which come with NOX emulator.
path = "D:/Program Files/Nox/bin"


# array of images and commands

img = []
command = []


#var for screenshot number 
var = 1

# Change the directory to it.
os.chdir(path)

# checking for connected devices
device = os.popen("adb devices").read().split('\n', 1)[1].split("device")[0].strip()

# connect to the selected device 172.0.0.1:62001
print("Waiting for connection ...")
connect = os.popen("adb connect " + device ).read()
print(connect)
Waiting for connection ...
already connected to 127.0.0.1:62001

In [3]:
#Method for storage commands into array
def commands(element):
    command.append(element)
In [4]:
##Method for installing an android APK

#install twitter app
def install_app(apk_path):
    os.system("adb install " + apk_path)
    commands("Command used: adb install " + apk_path)
    print("Command used: adb install " + apk_path)
In [5]:
##Method for launching an android APK

#launch twitter app
def launch_app(apk_name):
    os.system("adb shell monkey -p "+ apk_name + " -c android.intent.category.LAUNCHER 1")
    commands("Command used: adb shell monkey -p "+ apk_name + " -c android.intent.category.LAUNCHER 1")
    print("Command used: adb shell monkey -p "+ apk_name + " -c android.intent.category.LAUNCHER 1")
In [6]:
#Method for uninstalling the app
def uninstall_app(apk_name):
    os.system("adb uninstall " + apk_name)
    commands("Command used: adb uninstall " + apk_name)
    print("Command used: adb uninstall " + apk_name)
In [7]:
#Method for taking an screenshot
def screenshot():
    os.system("adb shell screencap -p /sdcard/screencap.png")
    commands("Command used: adb shell screencap -p /sdcard/screencap.png")
    print("Command used: adb shell screencap -p /sdcard/screencap.png")
In [8]:
#Method for storage paths into array
def paths(element):
    img.append(element)
In [9]:
#Method for retrieving an screenshot


def retrieve_image(project_path,var):    
    print("Command used: adb pull /sdcard/screencap.png " + project_path + "/screencap_" + str(var) + ".png")
    os.system("adb pull /sdcard/screencap.png " + project_path + "/screencap_" + str(var) + ".png")
    element = project_path + "/screencap_" + str(var) + ".png"
    paths(element)
    commands("adb pull /sdcard/screencap.png " + project_path + "/screencap_" + str(var) + ".png")
    
    
    #fp = open(project_path + "/screencap_" + str(var) + ".png","rb")
    #img = PIL.Image.open(fp)
    #img.show()
    
   
    
    
In [10]:
#method for display images 
def image_display():
    for image in img:
        i = Image(filename= image)
        display(i)
In [11]:
## Method for press back button every x number of events
def back_checker(i):
    if(i%4 == 0):
        os.system("adb shell input keyevent 4")
        commands("Command used: adb shell input keyevent 4")  

QUESTION 1

Go to the home menu and click on the first app avialable on the launcher, all via ADB.

  1. Using ADB, exit the current app.
  2. Using ADB, pull the display resolution and write it in the report.
  3. Using ADB, turn on bluetooth.
  4. Using ADB, launch the contacts app and add a new contact to the contact's list.

In [12]:
##Method for running the events sequentially
i = 0
while i <= N:
    
    
    
    install_app(apk_path)
    i = i + 1
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1
    back_checker(i)
    if i == N:
        break
    launch_app(apk_name)
    i= i + 1
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1    
    back_checker(i)
    if i == N:
        break
    
    #Question Events -> exit current app
    
    os.system("adb shell input keyevent 3")
    commands("Command used: adb shell input keyevent 3")  
    i = i + 1
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1
    back_checker(i)
    if i == N:
        break
        
   
        
    returned_output = subprocess.check_output("adb shell wm size")
    commands(returned_output.decode("utf-8"))  
    i = i + 1
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1
    back_checker(i)
    if i == N:
        break
        
# adb shell service call bluetooth_manager 6 to turn on, 8 turn off
    os.system("adb shell service call bluetooth_manager 6")
    commands("adb shell service call bluetooth_manager 6")  
    i = i + 1
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1
    back_checker(i)
    if i == N:
        break    
        
# adb create new contact: 
#adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Camila Fernandez' -e phone 123456789
#adb shell input keyevent 4
#adb shell input keyevent 4

    os.system("adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Camila" + str(i) + " Fernandez' -e phone 1234567")
    commands("adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Camila" + str(i) + " Fernandez' -e phone 1234567")  
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1
    os.system("adb shell input keyevent 4")
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1
    os.system("adb shell input keyevent 4")    
    i = i + 1
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1
    back_checker(i)
    if i == N:
        break  
    
uninstall_app(apk_name)
print(img)
print(command)
Command used: adb install C:/Users/User/Documents/ADB/com.twitter.android.apk
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_1.png
Command used: adb shell monkey -p com.twitter.android -c android.intent.category.LAUNCHER 1
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_2.png
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_3.png
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_4.png
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_5.png
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_6.png
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_7.png
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_8.png
Command used: adb install C:/Users/User/Documents/ADB/com.twitter.android.apk
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_9.png
Command used: adb shell monkey -p com.twitter.android -c android.intent.category.LAUNCHER 1
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_10.png
Command used: adb uninstall com.twitter.android
['C:/Users/User/Documents/ADB/screencap_1.png', 'C:/Users/User/Documents/ADB/screencap_2.png', 'C:/Users/User/Documents/ADB/screencap_3.png', 'C:/Users/User/Documents/ADB/screencap_4.png', 'C:/Users/User/Documents/ADB/screencap_5.png', 'C:/Users/User/Documents/ADB/screencap_6.png', 'C:/Users/User/Documents/ADB/screencap_7.png', 'C:/Users/User/Documents/ADB/screencap_8.png', 'C:/Users/User/Documents/ADB/screencap_9.png', 'C:/Users/User/Documents/ADB/screencap_10.png']
['Command used: adb install C:/Users/User/Documents/ADB/com.twitter.android.apk', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_1.png', 'Command used: adb shell monkey -p com.twitter.android -c android.intent.category.LAUNCHER 1', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_2.png', 'Command used: adb shell input keyevent 3', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_3.png', 'Physical size: 720x1280\r\r\n', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_4.png', 'Command used: adb shell input keyevent 4', 'adb shell service call bluetooth_manager 6', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_5.png', "adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Camila5 Fernandez' -e phone 1234567", 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_6.png', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_7.png', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_8.png', 'Command used: adb install C:/Users/User/Documents/ADB/com.twitter.android.apk', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_9.png', 'Command used: adb shell monkey -p com.twitter.android -c android.intent.category.LAUNCHER 1', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_10.png', 'Command used: adb shell input keyevent 4', 'Command used: adb uninstall com.twitter.android']

QUESTION 2

Go to the home menu and click on the first app avialable on the launcher, all via ADB.

  1. Go to the home menu and click on the first app avialable on the launcher, all via ADB.
  2. Go to the home menu and long tap the first 3 apps available on the launcher, all via ADB.
  3. Using ADB, verify the current battery percentage and write it in the report.
  4. Using ADB, turn on bluetooth.
  5. Using ADB, launch the contacts app and add a new contact to the contact's list.

In [13]:
##Method for running the events sequentially
i = 0
while i <= N:
    
    
    
    install_app(apk_path)
    i = i + 1
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1
    back_checker(i)
    if i == N:
        break
    launch_app(apk_name)
    i= i + 1
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1    
    back_checker(i)
    if i == N:
        break
    
    #Question Events -> exit current app
    
    os.system("adb shell input keyevent 3")
    commands("Command used: adb shell input keyevent 3")  
    os.system("adb shell input tap 76 464")    
    commands("adb shell input tap 76 464")  
    i = i + 1
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1
    back_checker(i)
    if i == N:
        break
        
    os.system("adb shell input keyevent 3")
    commands("Command used: adb shell input keyevent 3")  
    os.system("adb shell input tap 76 464 76 464 250")    
    commands("Command used: adb shell input tap 76 464 76 464 250") 
    os.system("adb shell input tap 214 474 214 474 250")    
    commands("Command used: adb shell input 214 474 214 474 250") 
    os.system("adb shell input tap 366 466 366 466 250")    
    commands("adb shell input tap 366 466 366 466 250")     
    i = i + 1
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1
    back_checker(i)
    if i == N:
        break    
   
        
        
    returned_output = subprocess.check_output("adb shell dumpsys battery")
    varx = returned_output.decode("utf-8").split('\r\r\n')
    level = varx[7]
    commands(level)  
    i = i + 1
    time.sleep(5)
    var = var + 1
    back_checker(i)
    if i == N:
        break
        
# adb shell service call bluetooth_manager 6 to turn on, 8 turn off
    os.system("adb shell service call bluetooth_manager 6")
    commands("adb shell service call bluetooth_manager 6")  
    i = i + 1
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1
    back_checker(i)
    if i == N:
        break    
        
# adb create new contact: 
#adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Camila Fernandez' -e phone 123456789
#adb shell input keyevent 4
#adb shell input keyevent 4

    os.system("adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Camila" + str(i) + " Fernandez' -e phone 1234567")
    commands("adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Camila" + str(i) + " Fernandez' -e phone 1234567")  
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1
    os.system("adb shell input keyevent 4")
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1
    os.system("adb shell input keyevent 4")    
    i = i + 1
    time.sleep(5)
    screenshot()
    retrieve_image(project_path,var)
    var = var + 1
    back_checker(i)
    if i == N:
        break  
    
uninstall_app(apk_name)
print(img)
print(command)
Command used: adb install C:/Users/User/Documents/ADB/com.twitter.android.apk
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_11.png
Command used: adb shell monkey -p com.twitter.android -c android.intent.category.LAUNCHER 1
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_12.png
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_13.png
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_14.png
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_16.png
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_17.png
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_18.png
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_19.png
Command used: adb install C:/Users/User/Documents/ADB/com.twitter.android.apk
Command used: adb shell screencap -p /sdcard/screencap.png
Command used: adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_20.png
Command used: adb uninstall com.twitter.android
['C:/Users/User/Documents/ADB/screencap_1.png', 'C:/Users/User/Documents/ADB/screencap_2.png', 'C:/Users/User/Documents/ADB/screencap_3.png', 'C:/Users/User/Documents/ADB/screencap_4.png', 'C:/Users/User/Documents/ADB/screencap_5.png', 'C:/Users/User/Documents/ADB/screencap_6.png', 'C:/Users/User/Documents/ADB/screencap_7.png', 'C:/Users/User/Documents/ADB/screencap_8.png', 'C:/Users/User/Documents/ADB/screencap_9.png', 'C:/Users/User/Documents/ADB/screencap_10.png', 'C:/Users/User/Documents/ADB/screencap_11.png', 'C:/Users/User/Documents/ADB/screencap_12.png', 'C:/Users/User/Documents/ADB/screencap_13.png', 'C:/Users/User/Documents/ADB/screencap_14.png', 'C:/Users/User/Documents/ADB/screencap_16.png', 'C:/Users/User/Documents/ADB/screencap_17.png', 'C:/Users/User/Documents/ADB/screencap_18.png', 'C:/Users/User/Documents/ADB/screencap_19.png', 'C:/Users/User/Documents/ADB/screencap_20.png']
['Command used: adb install C:/Users/User/Documents/ADB/com.twitter.android.apk', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_1.png', 'Command used: adb shell monkey -p com.twitter.android -c android.intent.category.LAUNCHER 1', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_2.png', 'Command used: adb shell input keyevent 3', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_3.png', 'Physical size: 720x1280\r\r\n', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_4.png', 'Command used: adb shell input keyevent 4', 'adb shell service call bluetooth_manager 6', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_5.png', "adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Camila5 Fernandez' -e phone 1234567", 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_6.png', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_7.png', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_8.png', 'Command used: adb install C:/Users/User/Documents/ADB/com.twitter.android.apk', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_9.png', 'Command used: adb shell monkey -p com.twitter.android -c android.intent.category.LAUNCHER 1', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_10.png', 'Command used: adb shell input keyevent 4', 'Command used: adb uninstall com.twitter.android', 'Command used: adb install C:/Users/User/Documents/ADB/com.twitter.android.apk', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_11.png', 'Command used: adb shell monkey -p com.twitter.android -c android.intent.category.LAUNCHER 1', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_12.png', 'Command used: adb shell input keyevent 3', 'adb shell input tap 76 464', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_13.png', 'Command used: adb shell input keyevent 3', 'Command used: adb shell input tap 76 464 76 464 250', 'Command used: adb shell input 214 474 214 474 250', 'adb shell input tap 366 466 366 466 250', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_14.png', 'Command used: adb shell input keyevent 4', '  level: 56', 'adb shell service call bluetooth_manager 6', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_16.png', "adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Camila6 Fernandez' -e phone 1234567", 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_17.png', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_18.png', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_19.png', 'Command used: adb install C:/Users/User/Documents/ADB/com.twitter.android.apk', 'Command used: adb shell screencap -p /sdcard/screencap.png', 'adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_20.png', 'Command used: adb shell input keyevent 4', 'Command used: adb uninstall com.twitter.android']
In [14]:
print("List of commands and screenshot for both of the Questionaries")
print("-------------------------------------------------------------")

print("-----------------COMMANDS-----------")
for x in command:
    print(x)
    
print("-----------------IMAGES-----------")
for image in img:
    vx = 1
    i = Image(filename= image)
    print("IMAGE # ", vx)
    display(i)
    vx = vx + 1
    
List of commands and screenshot for both of the Questionaries
-------------------------------------------------------------
-----------------COMMANDS-----------
Command used: adb install C:/Users/User/Documents/ADB/com.twitter.android.apk
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_1.png
Command used: adb shell monkey -p com.twitter.android -c android.intent.category.LAUNCHER 1
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_2.png
Command used: adb shell input keyevent 3
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_3.png


Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_4.png
Command used: adb shell input keyevent 4
adb shell service call bluetooth_manager 6
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_5.png
adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Camila5 Fernandez' -e phone 1234567
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_6.png
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_7.png
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_8.png
Command used: adb install C:/Users/User/Documents/ADB/com.twitter.android.apk
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_9.png
Command used: adb shell monkey -p com.twitter.android -c android.intent.category.LAUNCHER 1
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_10.png
Command used: adb shell input keyevent 4
Command used: adb uninstall com.twitter.android
Command used: adb install C:/Users/User/Documents/ADB/com.twitter.android.apk
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_11.png
Command used: adb shell monkey -p com.twitter.android -c android.intent.category.LAUNCHER 1
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_12.png
Command used: adb shell input keyevent 3
adb shell input tap 76 464
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_13.png
Command used: adb shell input keyevent 3
Command used: adb shell input tap 76 464 76 464 250
Command used: adb shell input 214 474 214 474 250
adb shell input tap 366 466 366 466 250
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_14.png
Command used: adb shell input keyevent 4
  level: 56
adb shell service call bluetooth_manager 6
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_16.png
adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Camila6 Fernandez' -e phone 1234567
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_17.png
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_18.png
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_19.png
Command used: adb install C:/Users/User/Documents/ADB/com.twitter.android.apk
Command used: adb shell screencap -p /sdcard/screencap.png
adb pull /sdcard/screencap.png C:/Users/User/Documents/ADB/screencap_20.png
Command used: adb shell input keyevent 4
Command used: adb uninstall com.twitter.android
-----------------IMAGES-----------
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
IMAGE #  1
In [15]:
from fpdf import FPDF
pdf = FPDF()
pdf.add_page()
pdf.set_font("Arial", size=12)
pdf.cell(200, 10, txt="ADB - MIDTERM NOTEBOOK", ln=1, align="C")
for x in command:
    pdf.cell(200, 10, txt=x, ln=1, align="L")
for image in img:
    pdf.image(image)

pdf.output("C:/Users/User/Documents/ADB/ADB.pdf")
Out[15]:
''
In [ ]: